// pages/mch/clerk/list.js
const App = getApp()
import Util from '../../../utils/util'

Component({
  options: {
    addGlobalClass: true,
  },
  properties: {

  },
  data: {
    init: false,
    loading: false,
    CustomBar: App.Global.CustomBar,
    items: [],

    modal: '',
    nclk: {}
  },

  lifetimes: {
    attached() {
      wx.sub('ReloadClerkList', this, () => {
        this.execLoad()
      })
      this.execLoad()
    },
    detached() {
      wx.cancel('ReloadClerkList', this)
    },
  },
  methods: {
    execLoad() {
      this.setData({
        loading: true
      })
      App.doPost({
        uri: '/app/merchant/clerk/list',
        body: {

        },
        fnSucc: resp => {
          this.setData({
            init: true,
            loading: false,
            items: resp.data.items
          })
        }
      })
    },
    toPage(e) {
      wx.navigateTo({
        url: e.currentTarget.dataset.uri
      })
    },
  }
})